package com.lagou.guavacache.enums;

import lombok.Getter;

@Getter
public enum EducationTypeEnum {
    TYPE_1("不限", 1),
    TYPE_2("初中", 2),
    TYPE_3("中专", 3),
    TYPE_4("高中", 4),
    TYPE_5("大专", 5),
    TYPE_6("本科", 6),
    TYPE_7("研究生", 7),
    TYPE_8("硕士", 8),
    TYPE_9("博士", 9);

    private String name;
    private int code;

    EducationTypeEnum(String name, int code) {
        this.name = name;
        this.code = code;
    }

    public static String getNameByCode(int code) {
        for (EducationTypeEnum item : EducationTypeEnum.values()) {
            if (item.getCode() == code) {
                return item.getName();
            }
        }
        return null;
    }
}
